package com.h3c.nem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.h3c.nem.mapper.TbOfferContactorMapper;
import com.h3c.nem.entity.TbOfferContactor;
import com.h3c.nem.mapstruct.TbOfferContactorMapstruct;
import com.h3c.nem.service.ITbOfferContactorService;
import com.h3c.nem.utils.CommonUtil;
import com.h3c.nem.vo.TbOfferContactorVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 紧急联系人实现类
 *
 * @author chenyifan
 * @since 2022-06-06 10:06:47
 */
@Service
public class TbOfferContactorServiceImpl extends ServiceImpl<TbOfferContactorMapper, TbOfferContactor> implements ITbOfferContactorService {

    @Override
    public List<TbOfferContactorVO> showContactorInfo() {
        List<TbOfferContactor> contactors = list(new QueryWrapper<TbOfferContactor>().lambda()
                .eq(TbOfferContactor::getWorkerId, CommonUtil.getActivUser().getUserId())
        );
        return TbOfferContactorMapstruct.INSTANCE.entityList2VOList(contactors);
    }

    @Override
    public List<TbOfferContactorVO> getContactorList(String workerId) {
        List<TbOfferContactor> contactors = list(new QueryWrapper<TbOfferContactor>().lambda()
                .eq(TbOfferContactor::getWorkerId, workerId));
        return TbOfferContactorMapstruct.INSTANCE.entityList2VOList(contactors);
    }
}

